package Netzwerkprogrammierung.g2.Sockets;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class SimpleTCPServer {

	/**
	 * @param args
	 * @throws IOException 
	 */
	public static void main(String[] args) throws IOException {
		
		ServerSocket server = new ServerSocket(1234);
		
		//Socket client = new Socket("127.0.0.1",1234);
		
		Socket socket = server.accept();
		
		BufferedReader in = new BufferedReader(
				new InputStreamReader(socket.getInputStream()));
		
		String text = in.readLine();
		
		BufferedWriter out = new BufferedWriter(
				new OutputStreamWriter(socket.getOutputStream()));
		
		out.write(text.toUpperCase());
		out.newLine();
		
		out.close();
		in.close();
		
		socket.close();
	}

}
